// -----------------------------------------------------------------------
//  <copyright file="RemoveResourceAuthCacheCommand.cs" company="LiuliuSoft">
//      Copyright (c) 2022-2025 DaprPlus. All rights reserved.
//  </copyright>
//  <site>https://dapr.plus</site>
//  <last-editor>郭明锋</last-editor>
//  <last-date>2025/1/8 18:26</last-date>
// -----------------------------------------------------------------------

namespace DaprPlus.Authorization.Application.Commands;


public class RemoveResourceAuthCacheCommand : IRequest<bool>
{
    public required long[] ResourceIds { get; set; }
}

public class RemoveResourceAuthCacheCommandHandler(IAuthorizationCache cache) : IRequestHandler<RemoveResourceAuthCacheCommand, bool>
{
    public async Task<bool> Handle(RemoveResourceAuthCacheCommand request, CancellationToken cancellationToken)
    {
        await cache.RemoveResourceAuthorizationCache(request.ResourceIds);
        return true;
    }
}
